package com.atguigu.util.homework1;

/**
 * @author caesar
 * @date 2025/7/4
 * @apiNote
 */
public class TriangleTools {
    public static boolean isTriangle(double a, double b, double c) {
        return a + b > c && a + c > b && b + c > a;
    }

    public static boolean isRightTriangle(double a, double b, double c) {
        return a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a;
    }

    public static boolean isEquilateralTriangle(double a, double b, double c) {
        return a == b && b == c;
    }

    //等腰三角形
    public static boolean isIsoscelesTriangle(double a, double b, double c) {
        return a == b || a == c || b == c;
    }

    public static double area(double a, double b, double c) {
        double p = (a + b + c) / 2;
        return Math.sqrt(p * (p - a) * (p - b) * (p - c));
    }

    public static double perimeter(double a, double b, double c) {
        return a + b + c;
    }
}
